# 进程间的通信
from multiprocessing import Queue

q = Queue(5)

q.put('A')
q.put('B')
q.put('C')
q.put('D')
q.put('E')
print(q.qsize())
if not q.full(): # full() 判断队列是否满了 empty() 判断队列是否为空
    q.put('F',timeout = 3) # put() 如果queue满了，就阻塞等待，除非有'空地'，则添加成功
else:
    print('queue已满')

print(q.get(timeout=1))
print(q.get(timeout=1))
print(q.get(timeout=1))
print(q.get(timeout=1))
print(q.get(timeout=1))
print(q.get(timeout=1))
print(q.get(timeout=1))
